layui.config({
	base: '/js/'
}).use(['element', 'layer', 'navbar', 'tab'], function() {
	var $ = layui.jquery,
		navbar = layui.navbar(),
		tab = layui.tab({
			elem: '.admin-nav-card' //设置选项卡容器
		});
	//iframe自适应
	$(window).on('resize', function() {
		var $content = $('.admin-nav-card .layui-tab-content');
		$content.height($(this).height() - 115);
		$content.find('iframe').each(function() {
			$(this).height($content.height()-3);
		});
	}).resize();
	$.get("/menus/list",function (ret){
		//设置navbar
		navbar.set({
			spreadOne: true,
			elem: '#admin-navbar-side',
			cached: true,
			data: ret
		});
		//渲染navbar
		navbar.render();
		//监听点击事件
		navbar.on('click(side)', function(data) {
			tab.tabAdd(data.field);
		});
	});

});